package mongo;


import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import org.bson.codecs.configuration.CodecProvider;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.codecs.pojo.PojoCodecProvider;
import org.bson.json.JsonObject;
import org.bson.types.ObjectId;

import static com.mongodb.MongoClientSettings.getDefaultCodecRegistry;
import static com.mongodb.client.model.Filters.eq;
import static org.bson.codecs.configuration.CodecRegistries.fromProviders;
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries;

/**
 * @author : zGame
 * @version V1.0
 * @Project: mongo-java-demo
 * @Package mongo
 * @Description: TODO
 * @date Date : 2022年01月26日 14:03
 */
public class MyMongoClient {
    
    public static void main(String[] args) {
    
        DbUtil dbutil =  new DbUtil("gameplayer");
        Player p = dbutil.find(eq("_id",new ObjectId("62023d6f7e4051602dfb10ea")),Player.class);
        System.out.println();
       // Player player = dbutil.find(eq("userName","savedPlayer2"),Player.class);
       // player.setUserName("changeName11111");
       // dbutil.update(player);
        
//        Player player = new Player();
//        player.setUserName("savedPlayer6");
//        player.setChannel("channel");
//        player.setId(new ObjectId());
//        dbutil.save(player);
    }
}
